package com.lonwin.inspectionmanagement.mvp.ui.activity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.ArrayMap;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.amap.api.location.AMapLocation;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.google.gson.Gson;
import com.hss01248.dialog.StyledDialog;
import com.hss01248.dialog.interfaces.MyDialogListener;
import com.jess.arms.base.BaseActivity;
import com.jess.arms.di.component.AppComponent;
import com.jess.arms.utils.ArmsUtils;
import com.jess.arms.utils.DataHelper;
import com.lh.LhEarthSurfaceView;
import com.lh.LhSmoothEarthSurfaceView;
import com.lh.features.LhCoordinate;
import com.lh.layers.LhLayer;
import com.lh.layers.LhLayerList;
import com.lh.layers.imageLayers.GaoDeMapLayer;
import com.lh.layers.imageLayers.TiandituRoadsLayer;
import com.lonwin.inspectionmanagement.R;
import com.lonwin.inspectionmanagement.R2;
import com.lonwin.inspectionmanagement.app.AppConstants;
import com.lonwin.inspectionmanagement.app.service.LocationService;
import com.lonwin.inspectionmanagement.app.utils.AppUtil;
import com.lonwin.inspectionmanagement.app.utils.DataUtil;
import com.lonwin.inspectionmanagement.app.utils.LhEarthUtils;
import com.lonwin.inspectionmanagement.app.utils.TimeUtils;
import com.lonwin.inspectionmanagement.di.component.DaggerHomeCruiseComponent;
import com.lonwin.inspectionmanagement.di.module.HomeCruiseModule;
import com.lonwin.inspectionmanagement.mvp.contract.HomeCruiseContract;
import com.lonwin.inspectionmanagement.mvp.model.api.Api;
import com.lonwin.inspectionmanagement.mvp.model.api.AppConstant;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.ConfigBean;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.CreaQuestResultBean;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.GpsUpdataInfoBean;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.HhkqLhAliasBean;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.NLocusSResult;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.PatrolBean;
import com.lonwin.inspectionmanagement.mvp.model.entity.bean.SearLocusBean;
import com.lonwin.inspectionmanagement.mvp.presenter.HomeCruisePresenter;
import com.lonwin.inspectionmanagement.mvp.ui.adapter.HomepopuwindowAdaptert;
import com.lonwin.inspectionmanagement.widget.dialog.LoadingDailog;

import org.simple.eventbus.Subscriber;
import org.simple.eventbus.ThreadMode;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;

import butterknife.BindView;
import butterknife.ButterKnife;

import static com.jess.arms.utils.Preconditions.checkNotNull;


public class HomeCruiseActivity extends BaseActivity<HomeCruisePresenter> implements HomeCruiseContract.View {

    @BindView(R2.id.home_LhEarthSurfaceView)
    LhEarthSurfaceView homeLhEarthSurfaceView;
    @BindView(R2.id.home_name_txt)
    TextView homeNameTxt;
    @BindView(R2.id.home_CruiseRecordingActivity)
    TextView homeCruiseRecordingActivity;
    @BindView(R2.id.home_LinearLayout1)
    LinearLayout homeLinearLayout1;
    @BindView(R2.id.home_RecyclerView)
    RecyclerView homeRecyclerView;
    @BindView(R2.id.home_map_img)
    ImageView homeMapImg;
    @BindView(R2.id.home_location_img)
    ImageView homeLocationImg;
    @BindView(R2.id.home_LinearLayout2)
    LinearLayout homeLinearLayout2;
    @BindView(R2.id.home_Cruise_poing_txt)
    TextView homeCruisePoingTxt;
    @BindView(R2.id.home_Cruise_poing_lay)
    LinearLayout homeCruisePoingLay;
    @BindView(R2.id.home_CruiseTime)
    TextView homeCruiseTime;
    @BindView(R2.id.home_address_mileage)
    TextView homeAddressMileage;
    @BindView(R2.id.home_RecordingPause)
    TextView homeRecordingPause;
    @BindView(R2.id.home_RecordingEnd)
    TextView homeRecordingEnd;
    @BindView(R2.id.home_LinearLayout_Cruise)
    LinearLayout homeLinearLayoutCruise;
    @BindView(R2.id.home_LinearLayout3)
    LinearLayout homeLinearLayout3;
    @BindView(R2.id.home_tip_txt)
    TextView home_tip_txt;
   private long firstTime=0;
   private int pointTime=0;//记录巡河时间
    private int mselectId=0;
//    private List<HhkqLhAliasBean.DataBean> mdataBeans;//所有河湖信息
    private HomepopuwindowAdaptert homepopuwindowAdapter;
    private int locationType=0;// 0--打点中 1--暂停 2--结束  3暂停后继续
    private boolean isLocation=false;//是否是定位
    private List<GpsUpdataInfoBean> gpsUpdataInfoBeans=new ArrayList<>();
    private PatrolBean startPatrolBean=null;
    private AMapLocation temAMapLocation;//当前的位置坐标

    @BindView(R2.id.home_Cruise_delpoing_lay)
    LinearLayout home_Cruise_delpoing_lay;
    @BindView(R2.id.home_Cruise_delpoing_txt)
    TextView home_Cruise_delpoing_txt;
    @BindView(R2.id.home_Cruise_delpoing_descript)
    TextView     home_Cruise_delpoing_descript;

    @BindView(R2.id.toolbar_back)
    RelativeLayout toolbar_back;

     private NLocusSResult.DataBean mDataBean;
    private LoadingDailog loadingDailog;
    private  double historyMileage=0;//历史的开始中和暂停的里程
    @Override
    public void setupActivityComponent(@NonNull AppComponent appComponent) {
        DaggerHomeCruiseComponent //如找不到该类,请编译一下项目
                .builder()
                .appComponent(appComponent)
                .homeCruiseModule(new HomeCruiseModule(this))
                .build()
                .inject(this);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        // TODO: add setContentView(...) invocation
        ButterKnife.bind(this);
        toolbar_back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

            }
        });
    }


    @Override
    public void onBackPressed() {
        if (locationType!=0)
        {
            killMyself();
            return;
        }
        StyledDialog.buildIosAlert("提示", "轨迹正在采集中，请先结束后再退出！\n" +
                "（直接退出轨迹将无法保存）", new MyDialogListener() {
            @Override
            public void onFirst() {
                StyledDialog.dismiss();
            }

            @Override
            public void onSecond() {
                StyledDialog.dismiss();
            }

        }).setBtnText("确定","").show();


    }


    @Override
    public int initView(@Nullable Bundle savedInstanceState) {
        return R.layout.activity_home_cruise; //如果你不需要框架帮你设置 setContentView(id) 需要自行设置,请返回 0
    }

    @Override
    public void initData(@Nullable Bundle savedInstanceState) {
        loadingDailog=new LoadingDailog.Builder(this).setMessage("处理中...").create();
        LhEarthUtils.addLayers(homeLhEarthSurfaceView,mPresenter.getConfigBean());
        LhEarthUtils.locatPosition(homeLhEarthSurfaceView, LhCoordinate.fromDegrees(getIntent().getDoubleExtra("lat",0), getIntent().getDoubleExtra("lont",0)));//25.07263654159436,102.66734565340529
        homepopuwindowAdapter=new HomepopuwindowAdaptert(new ArrayList<>());
        homeRecyclerView.setLayoutManager(new LinearLayoutManager(HomeCruiseActivity.this));
        homeRecyclerView.setAdapter(homepopuwindowAdapter);
          setListeners();
        home_Cruise_delpoing_txt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                ArmsUtils.makeText(HomeCruiseActivity.this,"整理问题");
            }
        });
        homeMapImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                homeMapImg.post(new Runnable() {
                    @Override
                    public void run() {
                        LhEarthUtils.setHide(homeLhEarthSurfaceView);
                    }
                });

            }
        });
        mPresenter.getMyLastXcpath();
    }



    public void setListeners(){
        homeLocationImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               isLocation=true;
                //从新请求定位
                if (locationType!=0)
                {
                    //没有再定位，就启定定位一次，其他情况已经在定位直接使用返回的定位信息
                   // startService(new Intent(HomeCruiseActivity.this, LocationService.class));
                    AppUtil.startService(HomeCruiseActivity.this,new Intent(HomeCruiseActivity.this, LocationService.class));
                }

            }
        });
        homeNameTxt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (startPatrolBean!=null)
                {
                    showMessage("开始巡河后不能切换河流");
                    return;
                }
                homeRecyclerView.setVisibility(View.VISIBLE);
//                homepopuwindowAdapter.setNewData(mdataBeans);
                AppUtil.setAnimator(homeRecyclerView);
                homepopuwindowAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                    @Override
                    public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                        mselectId=position;
//                        homeNameTxt.setText(mdataBeans.get(position).getAlias());
                        homeRecyclerView.setVisibility(View.GONE);
                    }
                });
            }
        });


        homeCruiseRecordingActivity.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(HomeCruiseActivity.this, NewCruiseRecordActivity.class);
                startActivity(intent);
            }
        });

         homeRecordingEnd.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
                 if (gpsUpdataInfoBeans.isEmpty())
                 {
                     ArmsUtils.makeText(HomeCruiseActivity.this,"请先记录轨迹");
                     return;
                 }
                 locationType=2;
                 //结束定位,上传
                 mPresenter.locatonForAddress(gpsUpdataInfoBeans.get(gpsUpdataInfoBeans.size()-1).getLatitude(),gpsUpdataInfoBeans.get(gpsUpdataInfoBeans.size()-1).getLongitude());

             }
         });
        homeCruisePoingTxt.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                if (temAMapLocation!=null){
                    CreatPointRecordActivity.startCreatPointActivity(HomeCruiseActivity.this,"",CreatPointRecordActivity.Type.ADD,"创建问题",1001,temAMapLocation.getLatitude(),temAMapLocation.getLongitude());
                }else {
                    double lat=getIntent().getDoubleExtra("lat",0);
                    double lont=getIntent().getDoubleExtra("lont",0);
                    CreatPointRecordActivity.startCreatPointActivity(HomeCruiseActivity.this,"",CreatPointRecordActivity.Type.ADD,"创建问题",1001,lat,lont);

                }
            }
        });

        homeRecordingPause.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                if (mDataBean!=null&&mDataBean.getStatus()==1)
                {
                 //暂停后再次继续
                    mPresenter.continueXcpathTemp(mDataBean.getGjid());
                    return;
                }
                if (temAMapLocation==null)
                {
                    ArmsUtils.makeText(HomeCruiseActivity.this,"正在定位请稍后再试");
                    isLocation=true;
                    //startService(new Intent(HomeCruiseActivity.this, LocationService.class));
                    AppUtil.startService(HomeCruiseActivity.this,new Intent(HomeCruiseActivity.this, LocationService.class));
                    return;
                }
                if (locationType==0)
                {
                    locationType=1;
                }else
                {
                    locationType=0;
                }
                mPresenter.locatonForAddress(temAMapLocation.getLatitude(),temAMapLocation.getLongitude());
            }
        });
    }
    public void    startPauseControl(){
//获取最近的一个轨迹记录状态 轨迹状态 0--打点中 1--暂停 2--结束
        if (locationType==2)
        {
            //显示开始打点
            homeRecordingPause.setText("开始");
        }else if (locationType==0){
            //开始打点
            homeRecordingPause.setText("暂停");
            Intent intent=new Intent(HomeCruiseActivity.this, LocationService.class);
            intent.putExtra("isloop",true);
            AppUtil.startService(this,intent);

        }else {
            //暂停
            homeRecordingPause.setText("继续");
            Intent intent=new Intent(HomeCruiseActivity.this, LocationService.class);
            stopService(intent);

        }

    }
    /**
     * 开始暂停结束控制
     */
    public void startPauseInit()
    {
        //获取最近的一个轨迹记录状态 轨迹状态 0--打点中 1--暂停 2--结束
        NLocusSResult.DataBean dataBean=DataHelper.getDeviceData(this,AppConstant.NLOCUSRESULT_DATABEAN_KEY);
        if (dataBean==null||dataBean.getStatus()==2)
        {
            //显示开始打点
            homeRecordingPause.setText("开始");
            locationType=2;
        }else if (dataBean.getStatus()==0){
            //开始打点
            locationType=0;
            homeRecordingPause.setText("暂停");
            Intent intent=new Intent(HomeCruiseActivity.this, LocationService.class);
            intent.putExtra("isloop",true);
            //startService(intent);
            AppUtil.startService(HomeCruiseActivity.this,intent);
        }else {
            //暂停
            locationType=1;
            homeRecordingPause.setText("继续");
            Intent intent=new Intent(HomeCruiseActivity.this, LocationService.class);
            stopService(intent);

        }

    }
    @Override
    public void showLoading() {

        loadingDailog.show();
    }

    @Override
    public void hideLoading() {
        loadingDailog.dismiss();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        stopService(new Intent(HomeCruiseActivity.this,LocationService.class));
    }

    @Override
    public void showMessage(@NonNull String message) {
        checkNotNull(message);
        ArmsUtils.makeText(this,message);    }

    @Override
    public void launchActivity(@NonNull Intent intent) {
        checkNotNull(intent);
        ArmsUtils.startActivity(intent);
    }

    @Override
    public void killMyself() {
        finish();
    }


    @Subscriber(mode = ThreadMode.MAIN)
    public void reciverLocation(AMapLocation aMapLocation) {
        temAMapLocation=aMapLocation;
        if (isLocation)
        {
            //接收到定位信息
            LhEarthUtils.locatPosition(homeLhEarthSurfaceView, LhCoordinate.fromDegrees(aMapLocation.getLatitude(), aMapLocation.getLongitude()));//25.07263654159436,102.66734565340529
            isLocation=false;
        }
          if (locationType!=0)
          {
              return;
          }
        pointTime++;
        if ((System.currentTimeMillis()-firstTime)/1000> Api.TIME_TERVAL||(System.currentTimeMillis()-firstTime)/1000==Api.TIME_TERVAL)
        {
            firstTime=System.currentTimeMillis();
            homeCruiseTime.setText(DataUtil.formtTime(pointTime));
            //上一个点到这一个点的时间间隔
            //高德地图准换成gps
//                LhCoordinate lhCoordinate=    LhCoordUtil.gcj_To_Wgs84(LhCoordinate.fromDegrees(aMapLocation.getLatitude(), aMapLocation.getLongitude()));
            if (aMapLocation.getLongitude()>10&&aMapLocation.getLatitude()>10)
            {
                gpsUpdataInfoBeans.add(new GpsUpdataInfoBean(TimeUtils.date2String(new Date(),new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")),mPresenter.getConfigBean().getGpsId(),aMapLocation.getAltitude(),aMapLocation.getLongitude(),aMapLocation.getLatitude(),mPresenter.getConfigBean().getAdcd(),mPresenter.getConfigBean().getCurrentRole().getRoleID(), mPresenter.getConfigBean().getProjectId(),mPresenter.getConfigBean().getGpsName(),aMapLocation.getAccuracy()));
            }
            LhEarthUtils.drawLocus(homeLhEarthSurfaceView,gpsUpdataInfoBeans);
            homeAddressMileage.setText("里程："+(historyMileage+DataUtil.getMileage(gpsUpdataInfoBeans))+"米");


        }
    }


    @Override
    protected void onPause() {
        super.onPause();
//        homeLhEarthSurfaceView.onPause();
        home_Cruise_delpoing_lay.setVisibility(View.GONE);
    }

    @Override
    public Activity getActivity() {
        return this;
    }

    @Override
    public void updateDataSuccess(String result) {
        Log.d(TAG, "updateDataSuccess: "+result);
        if (result==null||!"1".equals(result))
        {
            showMessage("上传轨迹失败");
            return;
        }
        showMessage("上传轨迹成功");
        if (locationType==2)
        {
            Intent intent=new Intent();
              if (mDataBean!=null)
              {
                  intent.putExtra("NLocusSResultDataBean",mDataBean);
              }
            setResult(RESULT_OK,intent);
            killMyself();
        }

    }

    @Override
    public void startPatrolSuccess(PatrolBean patrolBean) {
        startPatrolBean=patrolBean;
    }

    @Override
    public void endPatrolSuccess(PatrolBean patrolBean) {
        mPresenter.updateData(new Gson().toJson(gpsUpdataInfoBeans));
    }

    @Override
    public void regeocodeAddress(String address) {
        //地理位置反编码
        //开始记录轨迹
        Map<String,Object> maps=new ArrayMap<>();
        if (locationType==0)
        {
            //开始定位
            maps.put("adcd",mPresenter.getConfigBean().getAdcd());
            maps.put("adcdnm",mPresenter.getConfigBean().getAdcdName());
            maps.put("gpsid",String.valueOf(mPresenter.getConfigBean().getGpsId()));
            maps.put("gpsnm",mPresenter.getConfigBean().getGpsName());
            maps.put("startaddr",address);
            maps.put("starttm",TimeUtils.date2String(new Date(),new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS")));
            mPresenter.cpathTemp("start",maps);
        }else if (locationType==1){
            NLocusSResult.DataBean dataBean=DataHelper.getDeviceData(HomeCruiseActivity.this,AppConstant.NLOCUSRESULT_DATABEAN_KEY);
            if (dataBean==null){
                ArmsUtils.makeText(HomeCruiseActivity.this,"数据异常");
                return;
            }
            //暂停中
            maps.put("endaddr",address);
            maps.put("gjid",dataBean.getGjid());
            maps.put("km",DataUtil.getMileage(gpsUpdataInfoBeans));
            if (mPresenter.getConfigBean().getRiverDatas()!=null&&mPresenter.getConfigBean().getRiverDatas().size()==1&&mPresenter.getConfigBean().getRiverDatas().get(0).getChildren()!=null&&mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().size()==1)
            {
                //只有一条河
                maps.put("groupid",mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().get(0).getId());
                maps.put("groupnm",mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().get(0).getName());
            }
            mPresenter.cpathTemp("pause",maps);

        }else {

           //结束定位
            NLocusSResult.DataBean dataBean=DataHelper.getDeviceData(HomeCruiseActivity.this,AppConstant.NLOCUSRESULT_DATABEAN_KEY);
            if (dataBean==null){
                ArmsUtils.makeText(HomeCruiseActivity.this,"数据异常");
                return;
            }
            maps.put("endaddr",address);
            maps.put("gjid",dataBean.getGjid());
            maps.put("km",String.valueOf(DataUtil.getMileage(gpsUpdataInfoBeans)));
            if (mPresenter.getConfigBean().getRiverDatas()!=null&&mPresenter.getConfigBean().getRiverDatas().size()==1&&mPresenter.getConfigBean().getRiverDatas().get(0).getChildren()!=null&&mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().size()==1)
            {
                //只有一条河
                maps.put("groupid",mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().get(0).getId());
                maps.put("groupnm",mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().get(0).getName());
            }
            mPresenter.cpathTemp("end",maps);
        }

    }


    @Override
    public void cpathTempSuccess(NLocusSResult.DataBean dataBean) {
       if (locationType==1||locationType==2)
       {
           //暂停和结束都上次轨迹信息
           mPresenter.updateData(new Gson().toJson(gpsUpdataInfoBeans));
       }
        mDataBean=dataBean;
        startPauseControl();
    }

    @Override
    public void getMyLastXcpathSuccess(NLocusSResult.DataBean bean) {

        if (bean!=null&&bean.getStatus()!=2)
        {
            //暂停和进行中
            historyMileage=DataUtil.getMileage_2(bean.getGpsPoints());
            pointTime=Integer.parseInt(bean.getTm());
            homeCruiseTime.setText(DataUtil.formtTime(pointTime));
           homeAddressMileage.setText("里程："+historyMileage+"米");
           LhEarthUtils.drawHistoryLocus(homeLhEarthSurfaceView,bean.getGpsPoints());
        }
        startPauseInit();
        isLocation=true;
      //  startService(new Intent(HomeCruiseActivity.this, LocationService.class));
        AppUtil.startService(HomeCruiseActivity.this,new Intent(HomeCruiseActivity.this, LocationService.class));
    }

    @Override
    public void continueXcpathTemp(NLocusSResult.DataBean dataBean) {
        mDataBean=dataBean;
        locationType=0;//暂停后再次继续
        startPauseControl();
    }

    @Override
    public void getCheckCount(String content,int num) {
        home_tip_txt.setVisibility(View.VISIBLE);
        home_tip_txt.setText(content);
        if (num>0)
        {
            home_tip_txt.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    startActivity(new Intent(HomeCruiseActivity.this,UpcomingListActivity.class));
                }
            });
        }else {
            home_tip_txt.setVisibility(View.GONE);
        }
    }

    @Override
    protected void onResume() {
        super.onResume();
//        homeLhEarthSurfaceView.onResume();
        mPresenter.getHzUnCheckXcjlbCount();

    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (requestCode==1001&&data!=null)
        {
            home_Cruise_delpoing_lay.setVisibility(View.VISIBLE);

            if (mPresenter.getConfigBean().getRiverDatas()!=null&&mPresenter.getConfigBean().getRiverDatas().size()==1&&mPresenter.getConfigBean().getRiverDatas().get(0).getChildren()!=null&&mPresenter.getConfigBean().getRiverDatas().get(0).getChildren().size()==1)
            {
                //只有一条河湖
                switch (requestCode){
                    case 1001:
                        //从打点记录里回来
                        home_Cruise_delpoing_descript.setText("问题已记录，在“巡查记录”里查看");
                        home_Cruise_delpoing_txt.setText("查看问题");
                        break;
                }
                home_Cruise_delpoing_txt.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        CreaQuestResultBean.DataBean dataBean=(CreaQuestResultBean.DataBean)data.getSerializableExtra(AppConstant.CREATPOINT);
                        CreatPointRecordActivity.startCreatPointActivity(HomeCruiseActivity.this,dataBean.getQuestid(),CreatPointRecordActivity.Type.ONLYONE,"查看问题");

                    }
                });
                return;
            }
            //两条和以上
            switch (requestCode){
                case 1001:
                    home_Cruise_delpoing_descript.setText("问题已记录，但还未关联到河湖");
                    home_Cruise_delpoing_txt.setText("编辑问题");
                    home_Cruise_delpoing_txt.setOnClickListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            CreaQuestResultBean.DataBean dataBean=(CreaQuestResultBean.DataBean)data.getSerializableExtra(AppConstant.CREATPOINT);
                            CreatPointRecordActivity.startCreatPointActivity(HomeCruiseActivity.this,dataBean.getQuestid(),CreatPointRecordActivity.Type.EDIT,"编辑问题");

                        }
                    });
                    break;
            }
        }
    }
}
